<%-- 
    Document   : viewOverallPerformance
    Created on : Jan 3, 2010, 11:05:18 AM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<form method="post">
    <table border="1">
        <tr><td colspan="4">Select a date:
                <select name="dateToView">
                    <c:forEach var="date" items="${dates}">
                        <option value="<fmt:formatDate value="${date}" pattern="yyyy/MM/dd"/>" ${selectedDate==date?"selected":""}><fmt:formatDate value="${date}" pattern="MMM d, yyyy"/></option>
                    </c:forEach>
                </select>
                <input type="submit" value="View"/>
            </td>
        </tr>
        <c:set var="total" value="0"/>
        <c:if test="${performanceRecords!=null}">
            <tr><th>#</th><th>Name</th><th>Account</th><th>Total sales</th></tr>
            <c:forEach var="performanceRecord" items="${performanceRecords}" varStatus="counter">
                <c:set var="total" value="${total+performanceRecord.totalSales}"/>
                <tr>
                    <td>${counter.count}</td>
                    <td>${performanceRecord.employee.fullname}</td>
                    <td>${performanceRecord.employee.username}</td>
                    <td>${performanceRecord.totalSales} VND</td>
                </tr>
            </c:forEach>
            <tr><td colspan="3">Overall total</td><td><strong>${total} VND</strong></td></tr>
        </c:if>
    </table>
</form>